package com.example.demo.thread.ch4.case01;

import com.example.demo.thread.util.Debug;

/**
 * @author: htc
 * @date: Created in 14:40 2019/1/8.
 */
public class CaseTest {
    public static void main(String[] args) throws Exception {
        String downloadUrl = "http://mirrors.nju.edu.cn/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso";

        //初始化下载器
        BigFileDownloader downloader = new BigFileDownloader(downloadUrl);

        //下载线程数
        int workerThreadsCount = Runtime.getRuntime().availableProcessors();
        long reportInterval =1;

        Debug.info("downloading %s%nConfig:worker threads:%s,reportInterval:%s s.", downloadUrl, workerThreadsCount, reportInterval);
        downloader.download(workerThreadsCount, reportInterval * 1000);
    }
}
